package com.metasoft.flex.dto {
	
	import flash.utils.getDefinitionByName;
	import com.metasoft.flex.dto.XMLInfo;	
	
	public class BioGraphicInfo 
	implements XMLInfo {
	
		// Elements
		private var name      :String; 
		private var password  :String;
		private var language  :String;
		private var birthDate :String;
		private var age       :String;
		private var ageGroup  :String;
		private var gender    :String;
		private var otherFamilyMember:String;
		
		// Attributes
		private var ageGroupMin : String;
		private var ageGroupMax : String;
		
		public function set AgeGroupMin(agMin:String):void {
			this.ageGroupMin = new String();
			this.ageGroupMin = agMin;
		}
		
		public function set AgeGroupMax(agMax:String):void {
			this.ageGroupMax = new String();			
			this.ageGroupMax = agMax;
		}
		
		public function get AgeGroupMin():String {
			return this.ageGroupMin;
		}
		
		public function get AgeGroupMax():String {
			return this.ageGroupMax;
		}
				
		public function set Name(name:String):void {
			this.name = new String();
			this.name = name;
		}
		
		public function set Password(password:String):void {
			this.password = new String();
			this.password = password;
		}
		
		public function set Language(language:String):void {
			this.language = new String();
			this.language = language;
		}
		
		public function set BirthDate(birthDate:String):void {
			this.birthDate = new String();
			this.birthDate = birthDate;
		}
		
		public function set Age(language:String):void {
			this.language = new String();
			this.language = language;
		}

		public function set AgeGroup(ageGroup:String):void {
			this.ageGroup = new String();
			this.ageGroup = language;
		}
		
		public function set Gender(gender:String):void {
			this.gender = new String();
			this.gender = gender;
		}
		
		public function set OtherFamilyMember(otherFamilyMember:String):void {
			this.otherFamilyMember = new String();
			this.otherFamilyMember = otherFamilyMember;
		}										
		
		public function get Language():String {
			return this.language;
		}
		
		public function get Name():String {
			return this.name;
		}
		
		public function get Password():String {
			return this.password;
		}
		
		public function get BirthDate():String {
			return this.birthDate;
		}
		
		public function get Age():String {
			return this.age;
		}		
		
		public function get AgeGroup():String {
			return this.ageGroup;
		}
		
		public function get Gender():String {
			return this.gender;
		}
		
		/**
		 * Converts this object to XML String.
		 */
		public function toXMLString():String {
			var xmlString:String = new String();
			xmlString = xmlString.concat("<urn2:BiographicInformation>");
					         
			if (name != null) {
				xmlString = xmlString.concat("<urn2:Name>");
				xmlString = xmlString.concat("<urn1:GivenName>");
				xmlString = xmlString.concat(this.Name);
			    xmlString = xmlString.concat("</urn1:GivenName>");	
			    xmlString = xmlString.concat("</urn2:Name>");
			}
			
			if (language != null)  {
				xmlString = xmlString.concat("<urn2:Language>");
				xmlString = xmlString.concat(this.language);	
				xmlString = xmlString.concat("</urn2:Language>");
			}
		    
		    if (age != null && Number(age) > 0) {
		    	xmlString = xmlString.concat("<urn2:Age>");
		    	xmlString = xmlString.concat(age);
		    	xmlString = xmlString.concat("</urn2:Age>");		    	
		    }
		    
		    if (ageGroupMin != null &&  ageGroupMax != null) {
		    	if (Number(ageGroupMin) > 0 && Number(ageGroupMax) > 0) {
					xmlString = xmlString.concat("<urn2:AgeGroup min=\"");
					xmlString = xmlString.concat(ageGroupMin);
					xmlString = xmlString.concat("max=\"");
					xmlString = xmlString.concat(ageGroupMax);
					xmlString = xmlString.concat(">");
					xmlString = xmlString.concat("</urn2:AgeGroup>");					
		    	}
		    }  	
		    xmlString = xmlString.concat("</urn2:BiographicInformation>");	

			return xmlString;	        
		}
	}
}